package com.cnap.multiclouldmgmt.util;

import io.fabric8.kubernetes.api.model.Quantity;
import org.junit.jupiter.api.Test;

import java.text.ParseException;

class QuantityUtilsTest {

    @Test
    void countCpuUseToN() throws ParseException {
        Quantity cpuQuantity  = new Quantity();
        cpuQuantity.setFormat("n");
        cpuQuantity.setAmount("10");
        QuantityUtils.countCpuUseToN(cpuQuantity);
        cpuQuantity.setFormat("m");
        QuantityUtils.countCpuUseToN(cpuQuantity);
        cpuQuantity.setFormat(null);
        QuantityUtils.countCpuUseToN(cpuQuantity);

    }

    @Test
    void countMemUseToKi() {

        Quantity memQuantity  = new Quantity();
        memQuantity.setAmount("10");
        memQuantity.setFormat("Ki");
        QuantityUtils.countMemUseToKi(memQuantity);
        memQuantity.setFormat("K");
        QuantityUtils.countMemUseToKi(memQuantity);
        memQuantity.setFormat("M");
        QuantityUtils.countMemUseToKi(memQuantity);
        memQuantity.setFormat("Mi");
        QuantityUtils.countMemUseToKi(memQuantity);
        memQuantity.setFormat("G");
        QuantityUtils.countMemUseToKi(memQuantity);
        memQuantity.setFormat("Gi");
        QuantityUtils.countMemUseToKi(memQuantity);
        memQuantity.setFormat("");
        QuantityUtils.countMemUseToKi(memQuantity);
    }

    @Test
    void changeCpuNtoM() {

        QuantityUtils.changeCpuNtoM(100l);
    }

    @Test
    void changeCpuNtoNum() {

        QuantityUtils.changeCpuNtoM(100l);
    }

    @Test
    void changeCpuNtoNumDouble() {

        QuantityUtils.changeCpuNtoNumDouble(1000l);
    }

    @Test
    void changeMemKitoMiDouble() {

        QuantityUtils.changeMemKitoMiDouble(1000l);
    }

    @Test
    void changeMemKitoMi() {

        QuantityUtils.changeMemKitoMi(1000l);
    }

    @Test
    void changeMemKitoMiNoMi() {

        QuantityUtils.changeMemKitoMiNoMi(1000l);
    }

    @Test
    void changeCpuNtoNumStr() {

        QuantityUtils.changeCpuNtoNumStr(1000l);
    }

    @Test
    void changeMemKitoGi() {

        QuantityUtils.changeMemKitoGi(1000l);
    }

    @Test
    void changeDiskBtoGB() {

        QuantityUtils.changeDiskBtoGB(1000l);

    }

    @Test
    void changeMemKiToGiStr() {

        QuantityUtils.changeMemKiToGiStr(1000l);
    }

    @Test
    void countStorageToKi() {

        Quantity memQuantity  = new Quantity();
        memQuantity.setAmount("10");
        memQuantity.setFormat("Ki");
        QuantityUtils.countStorageToKi(memQuantity);
        memQuantity.setFormat("K");
        QuantityUtils.countStorageToKi(memQuantity);
        memQuantity.setFormat("M");
        QuantityUtils.countStorageToKi(memQuantity);
        memQuantity.setFormat("Mi");
        QuantityUtils.countStorageToKi(memQuantity);
        memQuantity.setFormat("G");
        QuantityUtils.countStorageToKi(memQuantity);
        memQuantity.setFormat("Gi");
        QuantityUtils.countStorageToKi(memQuantity);
        memQuantity.setFormat("");
        QuantityUtils.countStorageToKi(memQuantity);
    }
}